#pragma once
#include "BaseInc.h"
#include "freetype/freetype.h"
#include "glew/glew.h"
struct CharTex
{
	GLuint  m_texID;
	wchar_t m_chaID;
	int     m_Width;
	int     m_Height;

	int     m_adv_x;
	int     m_adv_y;
	int     m_delta_x;
	int     m_delta_y;
public:
	CharTex()
	{
		m_texID = 0;
		m_chaID = 0;
		m_Width = 0;
		m_Height = 0;
	}
};
extern CharTex g_TexID[65536];
class TrueTypeFont
{
public:
	static TrueTypeFont* GetInst()
	{
		static TrueTypeFont inst;
		return &inst;
	}

	bool load(const char* font_file, int _w, int _h);
	CharTex* getTextChar(wchar_t ch);
	GLuint loadChar(wchar_t ch);
	void drawText(wchar_t* _strText, int x, int y, int maxW, int h);
private:
	FT_Library m_FT2Lib;
	FT_Face    m_FT_Face;
	int	m_w, m_h;
};